const crypto = require('crypto')

/**
 * @param {String} word
 * @param {String} salt
 */
function Md5Crypto(word, salt = '@pub') {
    const md5 = crypto.createHash('md5')
    //加盐混淆
    let saltWord = word.slice(0, 2) + salt + '!&*' + word.slice(2)

    return md5.update(saltWord).digest('hex')
}

module.exports = { Md5Crypto }